package tw.asap.plus.network.config;

import android.os.Build;

import retrofit.RequestInterceptor;
import tw.asap.plus.app.NearApplication;
import tw.asap.plus.common.ConstValue;
import tw.asap.plus.utils.NetUtil;
import tw.asap.plus.utils.SPUtil;

/**
 * Retrofit 的 请求拦截组件
 * <p>
 * Created by LiFZhe on 3/3/15.
 */
public class HRetrofitInterceptor implements RequestInterceptor {
    private String cookie;
    private String userAgent;

    public HRetrofitInterceptor() {
    }

    public HRetrofitInterceptor(String cookie) {
        this.cookie = cookie;
    }

    public HRetrofitInterceptor(String cookie, String userAgent) {
        this.cookie = cookie;
        this.userAgent = userAgent;
    }

    @Override
    public void intercept(RequestFacade request) {

//        SPUtil spUtil = SPUtil.getInstance(NearApplication.getNearApplicationContext());
//        request.addEncodedQueryParam("app_id",   spUtil.getString(ConstValue.Sp.APP_ID, ""));
//        request.addEncodedQueryParam("req_time", String.valueOf(System.currentTimeMillis()));
//        request.addEncodedQueryParam("clientv", spUtil.getString(ConstValue.Sp.APP_VERSION, ""));
//        request.addEncodedQueryParam("imei",    spUtil.getString(ConstValue.Sp.IMEI_NO, ""));
//        request.addEncodedQueryParam("systemv", Build.VERSION.SDK);
//        request.addEncodedQueryParam("push_id", spUtil.getString(ConstValue.Sp.PUSH_ID, ""));
//        request.addEncodedQueryParam("channel", spUtil.getString(ConstValue.Sp.CHANNEL, ""));
//        request.addEncodedQueryParam("net_type", NetUtil.isWifiConnect(NearApplication.getNearApplicationContext()) ? "wifi" : "3g");

    }
}
